﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LibraryMangementSystem
{
    public partial class login : Form
    {
        public login()
        {
            InitializeComponent();
        }
        LibraryEntities1 dbContext = new LibraryEntities1();
        private void button1_Click(object sender, EventArgs e)
        {
            String userName = textBox1.Text;
            String password = textBox2.Text;
            List<user> userList = dbContext.user.Where(U => U.username == userName && U.password == password &&U.flag == 1).ToList<user>();
            if (userList.Count() != 0)
            {
                MessageBox.Show("登录成功");
                this.Hide();
                index ind=new index();
                ind.Show();
                


            }
            else
            {
                Console.WriteLine("登陆失败");
                return;
            }
        }


    }
}
